<template>
<el-card shadow="never" class="aui-card--fill">
    <div class="mod-island-scenic__isscenicticket">
        <el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
            <el-form-item>
                <el-select v-model="dataForm.type" placeholder="时间范围选择" clearable>
                    <el-option v-for="item in times" :key="item.val" :label="item.label" :value="item.val">
                    </el-option>
                </el-select>
            </el-form-item>
            <el-form-item v-if="showDate">
                <el-date-picker v-model="value1" type="datetimerange" value-format="yyyy-MM-dd HH:mm:ss" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期">
                </el-date-picker>
            </el-form-item>
            <el-form-item>
                <el-button @click="getDataList()">{{ $t("query") }}</el-button>
            </el-form-item>
        </el-form>
        <el-table v-loading="dataListLoading" :data="dataList" border @selection-change="dataListSelectionChangeHandle" style="width: 100%" height="calc(100vh - 270px)">
            <!-- <el-table-column type="selection" header-align="center" align="center" width="50"></el-table-column> -->
            <el-table-column prop="totalSellCount" label="总卖出量" header-align="center" min-width="120px" fixed="left" align="center"></el-table-column>
            <el-table-column prop="scenicName" label="区域名称" header-align="center" min-width="150px" align="center"></el-table-column>
            <el-table-column prop="scenicSpotName" label="景区名称" header-align="center" align="center" min-width="150px"></el-table-column>
            <el-table-column prop="adultCount" label="成人卖出量" header-align="center" align="center" min-width="120px"></el-table-column>
            <el-table-column prop="adultTotalPrice" label="成人总销售额" header-align="center" min-width="120px" align="center"></el-table-column>
            <el-table-column prop="adultRatio" label="成人占比" header-align="center" min-width="120px" align="center"></el-table-column>
            <el-table-column prop="childCount" label="儿童卖出量" header-align="center" align="center" min-width="120px"></el-table-column>
            <el-table-column prop="childTotalPrice" label="儿童总销售额" header-align="center" align="center" min-width="120px"></el-table-column>
            <el-table-column prop="childRatio" label="儿童占比" header-align="center" align="center" min-width="120px">
            </el-table-column>
            <el-table-column prop="oldCount" label="老人卖出量" header-align="center" align="center" min-width="120px"></el-table-column>
            <el-table-column prop="oldTotalPrice" label="老人总销售额" header-align="center" align="center" min-width="120px"></el-table-column>
            <el-table-column prop="oldRatio" label="老人占比" header-align="center" align="center" min-width="120px"></el-table-column>
        </el-table>
        <el-pagination :current-page="page" :page-sizes="[10, 20, 50, 100]" :page-size="limit" :total="total" layout="total, sizes, prev, pager, next, jumper" @size-change="pageSizeChangeHandle" @current-change="pageCurrentChangeHandle">
        </el-pagination>
        <!-- 弹窗, 新增 / 修改 -->
    </div>
</el-card>
</template>

<script>
import mixinViewModule from "@/mixins/view-module";
export default {
    mixins: [mixinViewModule],
    data() {
        return {
            mixinViewModuleOptions: {
                getDataListURL: "/scenic/dataReport/querySellingInfo",
                getDataListIsPage: false,
            },
            dataForm: {
                type: '',
                startDate: '',
                endDate: '',
            },
            value1: [],
            showDate: false,
            times: [{
                val: 'custom',
                label: '自定义'
            }, {
                val: 'day',
                label: '当天'
            }, {
                val: 'week',
                label: '本周'
            }, {
                val: 'month',
                label: '本月'
            }, {
                val: 'year',
                label: '年度'
            }, ],

        };
    },
    watch: {
        value1(newval, oldval) {
            if (newval) {
                if (newval != oldval) {
                    this.dataForm.startDate = newval[0];
                    this.dataForm.endDate = newval[1];

                }
                // this.dataForm.type = "custom";
            } else {
                this.dataForm.startDate = '';
                this.dataForm.endDate = '';
                // this.dataForm.type = "";
            }
        },
        "dataForm.type"(newval) {
            if (newval == 'custom') {
                this.showDate = true
            } else {
                this.showDate = false;
                this.dataForm.startDate = '';
                this.dataForm.endDate = '';
            }
        }
    },
    created() {},
    methods: {

    },
};
</script>

<style lang="scss" scoped>
.status {
    display: inline-block;
    width: 68px;
    text-align: center;
    height: 28px;
    line-height: 28px;
    border-radius: 3px;
    font-size: 12px;
    color: #fff
}

.custom {
    display: inline-block;
    border: 1px solid #d6d7db;
    padding: 0 8px;
    margin-left: 10px;
    color: #666;
    font-size: 15px;
    box-sizing: border-box;
    height: 40px;
    border-radius: 3px;
    background: #ededed;
    cursor: pointer;

    i {
        font-size: 17px;
        margin-right: 5px;
        color: #666;
        vertical-align: text-top;
    }
}
</style>
